package com.medical.admin.cost.controller;

import com.medical.admin.cost.common.dto.DetailInfo;
import com.medical.admin.cost.common.dto.IndentDto;
import com.medical.admin.cost.service.IndentService;
import com.qf.medical.response.ResponseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * 1.查询订单信息
 * 2.新增订单
 * 3.修改订单信息
 * 4.删除订单信息
 * 5.展示订单相相关详细信息
 */
@Api(tags = "后台订单信息管理Api在线文档")
@RestController
@RequestMapping("/indent")
public class IndentController {
    @Resource
    private IndentService indentService;

    @ApiOperation("查询订单信息")
    @GetMapping("research/{patientId}")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    public ResponseEntity<IndentDto> research(@NotNull @PathVariable("patientId") Long patientId) {
        return ResponseEntity.success(indentService.research(patientId));
    }

    @ApiOperation("增加订单信息")
    @PostMapping("addIndent")
    @ApiImplicitParam(name = "indentDto",value = "患者Dto类")
    public ResponseEntity<Integer> addIndent(@NotNull @RequestBody IndentDto indentDto) {
        return ResponseEntity.success(indentService.addIndent(indentDto));
    }

    @ApiOperation("修改订单信息")
    @PutMapping("modifyIndent")
    @ApiImplicitParam(name = "indentDto",value = "患者Dto类")
    public ResponseEntity<Integer> modifyIndent(@NotNull @RequestBody IndentDto indentDto) {
        return ResponseEntity.success(indentService.modifyIndent(indentDto));
    }

    @ApiOperation("删除订单信息")
    @GetMapping("removeIndent/{patientId}")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    public ResponseEntity<Integer> removeIndent(@NotNull @PathVariable("patientId") Long patientId) {
        return ResponseEntity.success(indentService.removeIndent(patientId));
    }

    @ApiOperation("展示订单相关详细信息")
    @GetMapping("detailIndent")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    public ResponseEntity<DetailInfo> detailIndent(@NotNull Long patientId) {
        return ResponseEntity.success(indentService.detailIndent(patientId));
    }

}
